#ifndef SG_INTERPOLATE_H_INCLUDED
#define SG_INTERPOLATE_H_INCLUDED

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

struct twice_state
{
	int16_t memory[7];
};

/**
 * Interpolates a signal to twice the sampling rate
 *
 * Avoid calling this function for single samples. It works
 * much faster if you apply it to a larger block of samples
 * (say, 50 samples at once)
 *
 * @param s
 *   pointer to the internal state of the resampler
 * @param num_samples_in
 *   number of samples to process from in
 * @param in
 *   pointer to input sample buffer
 * @param out
 *   pointer to output sample buffer, needs at least
 *   num_samples_in*2 samples of space.
 */
extern void twice_process(
	struct twice_state *s,
	int num_samples_in,
	const int16_t in[],
	int16_t out[]);

#ifdef __cplusplus
}
#endif

#endif
